import { unpateS3Manager } from '../functions/S3Manager';

export const ACCOUNT_DELETE = 'ACCOUNT_DELETE';
export const ACCOUNT_UPDATE = 'ACCOUNT_UPDATE';
export const ACCOUNT_CREATE = 'ACCOUNT_CREATE';
export const ACCOUNT_SELECT = 'ACCOUNT_SELECT';
export const ACCOUNT_LIST = 'ACCOUNT_LIST';

export function deleteAccountAction(account) {
  return {
    type: ACCOUNT_DELETE,
    payload: {
      account: { ...account }
    }
  };
}

export function updateAccount(account) {
  return {
    type: ACCOUNT_UPDATE,
    payload: {
      account: { ...account }
    }
  };
}

export function createAccount(account) {
  return {
    type: ACCOUNT_CREATE,
    payload: {
      account: { ...account }
    }
  };
}

export function selectAccount(account) {
  return {
    type: ACCOUNT_SELECT,
    payload: {
      account: { ...account }
    }
  };
}

export function listAccount(accounts, currentId) {
  return {
    type: ACCOUNT_LIST,
    payload: {
      accounts: [...accounts],
      currentId: currentId
    }
  };
}
